UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yMCtzENRDwPhl84YUHyori6dc4JmxzW0A3vJZi8nvAQ=' 
WHERE 
  key_id = '0c6712a24438b620c85fa4b7260ea10731e61a66c21272a1a24119db244d1b2f' 
  AND (
    token = 'yMCtzENRDwPhl84YUHyori6dc4JmxzW0A3vJZi8nvAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034