UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eY2BMk9PPQSM7nvG2QkT4IWI+Uuw1CfV4BfDqrTIvb4=' 
WHERE 
  key_id = '5a15f1b9ce57b948baa098e5c42a211f5d9a29a2d1d2893975197b3d07de76b9' 
  AND (
    token = 'eY2BMk9PPQSM7nvG2QkT4IWI+Uuw1CfV4BfDqrTIvb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034