UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '583kpogorB0KwvKP9wSuCPzOUmF65+9e+r06iETJ/sE=' 
WHERE 
  key_id = '47d1ea12b0ab2934e6cec4faae2adb1bca73baadae2b4ae03e200df9cbddea51' 
  AND (
    token = '583kpogorB0KwvKP9wSuCPzOUmF65+9e+r06iETJ/sE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022