UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BJfZXmnZBwwjFDCOqz9skCBrn8WeCFupSJ+AUi2+yLw=' 
WHERE 
  key_id = '8c0a16e532f3fb8c968ab626fd8457943495aef051568764701c78b343fd2352' 
  AND (
    token = 'BJfZXmnZBwwjFDCOqz9skCBrn8WeCFupSJ+AUi2+yLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039