UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MEtwxFztFYDqv4aGCoYZwsec1lsnVtdxdrKW3xz0ews=' 
WHERE 
  key_id = '78b4baf2712acd3174f581506c108e7126951f32b438278c64634a094bdaedf0' 
  AND (
    token = 'MEtwxFztFYDqv4aGCoYZwsec1lsnVtdxdrKW3xz0ews=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029