UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MM0dA+JYzrXLLRbRkEncnJgZjyCvOa/uw+Asdus/f48=' 
WHERE 
  key_id = '6a12fd70b8c12ef1cba763439e23b0d74cf8631c5c56c2b0c681cc97348ab086' 
  AND (
    token = 'MM0dA+JYzrXLLRbRkEncnJgZjyCvOa/uw+Asdus/f48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043