UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NcucRaVKjV8vVho8KPu+LPfQpAIO5limImwcbg2rhBI=' 
WHERE 
  key_id = '9e5a017c70108ee6dccdd3b17ca3fe5b1e30340550c460da895a4f6402b85692' 
  AND (
    token = 'NcucRaVKjV8vVho8KPu+LPfQpAIO5limImwcbg2rhBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049