UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UbCkoT+5wDeQHQSkivdtDVDuHxiSKXOfBjVLsrNTVtw=' 
WHERE 
  key_id = '291b2d7c684e761f741611edc767b3e44e98cbbdcf2157d5e8505c8eba97e9e4' 
  AND (
    token = 'UbCkoT+5wDeQHQSkivdtDVDuHxiSKXOfBjVLsrNTVtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028