UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZe1UJgoerpzw8I53MehEwCj7tOK6N29NmRCeBu3CbA=' 
WHERE 
  key_id = '380f1066910dcd645248a22616f70423d9821736b3cda8e94b346bc3b5634773' 
  AND (
    token = 'wZe1UJgoerpzw8I53MehEwCj7tOK6N29NmRCeBu3CbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042