UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rd+wRadw5nygMma82x3F/xyz3QLdOMrvx1pAv0RvYXc=' 
WHERE 
  key_id = 'bb1a3b27796f845603c3fafeb5d31a7e9052acca60339d500541372dbde946d3' 
  AND (
    token = 'rd+wRadw5nygMma82x3F/xyz3QLdOMrvx1pAv0RvYXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018